// 这个文件给蓝牙编码用
const encoder = {
    init: function () {
        let command = [];

        encoder.addString = function (str) {
            const code = encodeURIComponent(str);//String转换为UTF-8，存入数组
            for (let i = 0; i < code.length; ++i) {
                command.push(Number(code[i].codePointAt(0)));
            }
        };
        encoder.addCode = content => {
            command.push(content);
        };
        encoder.getData = () => command;
        return encoder;
    }
};

module.exports = encoder;